var str=document.URL.split("?")[1];
var obj={};
var arr;
arr=str.split("=");
obj[arr[0]]=arr[1];
var no=obj.no;
var reply = new Vue({
    el: "#reply",
    data:
        {
            messages:''
        },
    methods:{
        send(){
            axios({
                method:'POST',
                url:'http://localhost:8099/allMessage/getOne/'+no
            }).then(function(res){
                reply.messages=res.data;

            }).catch(function (reason) {
                console.log(reason);
            })
        }, UpdateTime(){
            time = new Date();
            yea = time.getFullYear(); //获取完整的年份(4位,1970-???)
            mon = time.getMonth() + 1; //获取当前月份(0-11,0代表1月)
            day = time.getDate(); //获取当前日(1-31)
            hour = time.getHours(); //获取当前小时数(0-23)
            minute = time.getMinutes(); //获取当前分钟数(0-59)
            second = time.getSeconds(); //获取当前秒数(0-59)
            curtime = yea + "-" + mon + "-" + day + " " + hour + ":" + minute + ":" + second;
        },
        replyMessage() {
            reply.$set(reply.messages, "updateTime", curtime)
            console.log(reply.messages)
            axios({
                method: 'POST',
                url: 'http://localhost:8099/allMessage/update',
                data: {
                    "informationId": reply.messages.informationId,
                    "updateTime": reply.messages.updateTime,
                    "reply": reply.messages.reply,
                }
            }).then(function (res) {
                alert(res.data)
                reply.send()
            }).catch(function (reason) {
                alert(res.data)
            })
        }
    },
    //页面加载完自动执行
    mounted(){
        this.send();
        this.timer=setInterval(this.UpdateTime,1000)
    }
});